package com.heima.utils.thread;

public class WmThreadLocalUtil {

    private final static ThreadLocal<Integer> threadLocal = new ThreadLocal<>();

    /**
     * 添加用户id
     * @param id
     */
    public static void  setUserId(Integer id){
        threadLocal.set(id);
    }

    /**
     * 获取用户id
     */
    public static Integer getUserId(){
        return threadLocal.get();
    }

    /**
     * 清理用户id
     */
    public static void remove(){
        threadLocal.remove();
    }
}